<?php


namespace App\controllers\admin;


use App\controllers\Base;
use Helper\Config;
use Helper\Output;
use Helper\Mysql;
use Firebase\JWT\JWT;
use Helper\Reg;

class QuickPelay extends Base
{

    public function index($request, $response){

        $list = Mysql::getInstance()->where('auid',$this->getUserId())->get('quick_pelay');

        return Output::json(200,$list);

    }

    public function create($request, $response){


        $request->post['auid'] = $this->getUserId();
        $request->post['create_at'] = time();

        $res = Mysql::getInstance()->insert('quick_pelay',$request->post);
        if($res){
            return Output::json(200);
        }
        return Output::json(400);
    }


    public function edit($request, $response){

        $id = $request->post['id'];
        unset($request->post['id']);
        $res = Mysql::getInstance()->where('id',$id)->update('quick_pelay',$request->post);
        if($res){
            return Output::json(200);
        }
    }

}